package my.soft.aiteacher.teacher.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import my.soft.aiteacher.teacher.pojo.QuestionnaireDO;
import my.soft.aiteacher.teacher.pojo.QuestionnaireVO;
import my.soft.aiteacher.teacher.service.IQuestionService;
import my.soft.aiteacher.teacher.service.IQuestionnaireService;
import my.soft.aiteacher.utils.R;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@Tag(name = "教师-问卷管理",description = "教师-问卷管理")
public class QuestionnaireController {
    @Resource
    private IQuestionnaireService questionnaireService;
    /**
     * Method POST
     * 上传问卷
     */
    @Operation(summary = "上传问卷",description = "上传问卷")
    @RequestMapping(value = "/questionnaire/upload",method = RequestMethod.POST)
    public R uploadQuestionnaire(@RequestBody QuestionnaireVO questionnaireVO) {
        questionnaireService.uploadQuestionnaire(questionnaireVO);
        return R.success("ok");
    }
    @Operation(summary = "查询问卷",description = "查询问卷")
    @RequestMapping(value = "/questionnaire/query/{fileId}",method = RequestMethod.GET)
    public R queryQuestionnaire(@PathVariable String fileId) {
        List<QuestionnaireVO> questionnaireVOList = questionnaireService.queryQuestionnaire(fileId);

        return R.success(questionnaireVOList);
    }


}
